import React, { useState, useEffect } from 'react';
import Header from './components/header'
import Search from './components/search'
import Hot from './components/hot'
import './index.less'
import { useHttpHook } from '@/hooks'
import { ErrorBoundary } from '@/components'

export default function () {
  const [citys, citysLoading] = useState([{ label: '杭州', value: '10001' }, { label: '苏州', value: '10002' }])
  const [houses] = useState([
    {
      id: 1,
      img: 'https://cdn.pixabay.com/photo/2014/08/12/00/01/santorini-416136__340.jpg',
      title: '东城民宿',
      info: '东城区交通方便',
      price: '100'
    },
    {
      id: 2,
      img: 'https://cdn.pixabay.com/photo/2014/05/08/15/37/coast-340348__340.jpg',
      title: '西城民宿',
      info: '西城区山水怡情',
      price: '120'
    },
    {
      id: 3,
      img: 'https://cdn.pixabay.com/photo/2019/11/08/18/16/matera-4612016__340.jpg',
      title: '新区民宿',
      info: '新区民宿位置优越',
      price: '200'
    },
    {
      id: 4,
      img: 'https://cdn.pixabay.com/photo/2016/02/27/21/01/ancient-1226277__340.jpg',
      title: '老城民宿',
      info: '老城区风景秀美',
      price: '220'
    }
  ])

  return (
    <ErrorBoundary>
      <div className="home">
        {/* header 登录 */}
        <Header />
        {/* 搜索 */}
        {citys && <Search citys={citys} citysLoading={citysLoading} />}
        {/* 热门民俗 */}
        {houses && <Hot houses={houses} />}
      </div>
    </ErrorBoundary>
  )
}